home *** CD-ROM | disk | FTP | other *** search
/ InterCD 2000 September / september_2000.iso / intercd / root / ^Linux / cdrtools-1.10 / lib / stdio / fileopen.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-04  |  1.1 KB  |  39 lines

  1. /* @(#)fileopen.c    1.6 96/02/04 Copyright 1986, 1995 J. Schilling */
  2. /*
  3.  *    Copyright (c) 1986, 1995 J. Schilling
  4.  */
  5. /* This program is free software; you can redistribute it and/or modify
  6.  * it under the terms of the GNU General Public License as published by
  7.  * the Free Software Foundation; either version 2, or (at your option)
  8.  * any later version.
  9.  *
  10.  * This program is distributed in the hope that it will be useful,
  11.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.  * GNU General Public License for more details.
  14.  * 
  15.  * You should have received a copy of the GNU General Public License
  16.  * along with this program; see the file COPYING.  If not, write to
  17.  * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
  18.  */
  19.  
  20. #include <stdio.h>
  21. #include "io.h"
  22.  
  23. FILE    *fileopen (name, mode)
  24.     const char    *name;
  25.     const char    *mode;
  26. {
  27.     int    ret;
  28.     int    omode = 0;
  29.     int    flag = 0;
  30.  
  31.     if (!_cvmod (mode, &omode, &flag))
  32.         return (FILE *) NULL;
  33.  
  34.     if ((ret = _openfd(name, omode)) < 0)
  35.         return (FILE *) NULL;
  36.  
  37.     return _fcons ((FILE *)0, ret, flag);
  38. }
  39.